﻿@model WishlistModel
@using Nop.Core.Domain.Orders;
@using Nop.Web.Models.Checkout;
@using Nop.Web.Models.ShoppingCart;
<div id="flyout-wishlist">
    <div class="mini-wishlist">
        <div class="cart-top">
            @{ 
                int itemCount = 0;
                
                for (int i = 0; i < Model.Items.Count; i++)
                {
                    var item = Model.Items[i];
                    itemCount += item.Quantity;
                }
            
            }
            
            @if (itemCount == 0)
            {
                <div>@*T("ShoppingCart.Mini.NoItems")*@Coming Soon</div>
            }
            else
            {
                if (itemCount == 1)
                {
                    //+string+
                    //@Html.Raw(string.Format(@T("ShoppingCart.Mini.OneItemText").Text, string.Format("<a href=\"{0}\" class=\"items\">{1}</a>", Url.RouteUrl("Wishlist"), T("ShoppingCart.Mini.OneItem").Text)))
                    <span>There is <a href="@Url.RouteUrl("Wishlist")" class="items">@itemCount item</a> in your wishlist.</span>
                }
                else
                {
                    //+string+
                    //@Html.Raw(string.Format(@T("ShoppingCart.Mini.SeveralItemsText").Text, string.Format("<a href=\"{0}\" class=\"items\">{1}</a>", Url.RouteUrl("Wishlist"), string.Format(T("ShoppingCart.Mini.SeveralItems").Text, itemCount))))
                    <span>There are <a href="@Url.RouteUrl("Wishlist")" class="items">@itemCount items</a> in your wishlist.</span>
                }
                <a class="minicart-clearcart" href="@Url.RouteUrl("RemoveAllProductsFromCart", new { shoppingCartTypeId = 2 })" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("RemoveAllProductsFromCart", new { shoppingCartTypeId = 2 })'); return false;">Clear Wishlist</a>
            }
        </div>
        @if (Model.Items.Count > 0)
        {
            if (Model.Items.Count > 0)
            {
            <div class="wishlist-items">
                <table>
                    <tbody>
                        @for (int i = 0; i < Model.Items.Count; i++)
                        {
                            var item = Model.Items[i];
                            <tr class="item @(i == 0 ? "first" : null) @(i % 2 == 0 ? "odd" : "even")">
                                @if (Model.ShowProductImages)
                                {
                                    <td class="picture">
                                        <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="@item.Picture.Title">
                                            <div class="cart-item-image">
                                                <img alt="@item.Picture.AlternateText" src="@item.Picture.ImageUrl" title="@item.Picture.Title" />
                                            </div>
                                        </a>
                                    </td>
                                }
                                <td class="product">
                                    <div class="name">
                                        <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a>
                                    </div>
                                    @if (!String.IsNullOrEmpty(item.AttributeInfo))
                                    {
                                        <div class="clear">
                                        </div>
                                        <div class="attributes">
                                            @Html.Raw(item.AttributeInfo)
                                        </div>
                                    }
                                    <div class="clear">
                                    </div>
                                    <div class="price">@T("ShoppingCart.Mini.UnitPrice"): @item.UnitPrice</div>
                                    <div class="quantity">@T("ShoppingCart.Mini.Quantity"): @item.Quantity</div>
                                    <div class="clear">
                                    </div>
                                    
                                </td>
                                <td class="product-add">
                                    <p class="a-center">
                                        @{
                                            //+string+    
                                        }
                                        <a title="Add to Shopping Cart" class="icon icon-add" href="@Url.RouteUrl("AddtoCartfromWishlist", new { productId = item.Id})" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("AddtoCartfromWishlist", new { productId = item.Id })'); return false;">Add</a>
                                    </p>
                                </td>
                                <td class="product-remove">
                                        @{
                                            //+string+    
                                        }
                                        <a @*title="@T("Common.Remove")"*@ title="Remove from Wishlist" class="icon icon-remove" href="@Url.RouteUrl("RemoveProductFromCart", new { productVariantId = item.Id, shoppingCartTypeId = 2 })" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("RemoveProductFromCart", new { productVariantId = item.Id, shoppingCartTypeId = 2 })'); return false;">@T("Common.Remove")</a>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
            }
            
            <div class="cart-bottom">

                <div class="buttons">
                    @{
                    //+string+
                    }
                    <a href="@Url.RouteUrl("Wishlist")" class="button-grey wishlist-button" onclick="setLocation('@Url.RouteUrl("Wishlist")'); return false;">Go to Wishlist</a>
                    
                    @if (Model.DisplayAddToCart)
                    {
                        //+string+
                        <a class="button-grey cart-button" href="@Url.RouteUrl("AddtoCartfromWishlist")" onclick="AjaxCart.addproductvarianttocart('@Url.RouteUrl("AddtoCartfromWishlist")'); return false;">Add all to Cart</a>
                    
                    }

                </div>
            </div>
           
        }
    </div>
</div>
